package net.organizer.ui;

import com.google.appengine.repackaged.com.google.common.collect.*;
import java.util.*;
import net.organizer.ui.actionhandler.*;

public class ServletReqEnums {

//--------------------------------------------------------------------------------------------------

public enum EActionHandler {
GetContext(GetContextActionHandler.class),
LoadSampleData(LoadSampleDataActionHandler.class),
OrgDelete(OrgDeleteActionHandler.class),
OrgGetList(OrgGetListActionHandler.class),
OrgGetOne(OrgGetOneActionHandler.class),
OrgPutCreate(OrgPutCreateActionHandler.class),
OrgPutUpdate(OrgPutUpdateActionHandler.class),
PersonDelete(PersonDeleteActionHandler.class),
PersonGetList(PersonGetListActionHandler.class);

private static Map<String, EActionHandler> _actionHandlerMap;
private Class<? extends ActionHandlerBase> _actionHandlerClass;
private String                             _url;
static {
  _actionHandlerMap = Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
} // static initializer
private EActionHandler(final Class<? extends ActionHandlerBase> actionHandlerClass) {
  _actionHandlerClass = actionHandlerClass;
  _url = "/" + name().substring(0, 1).toLowerCase() + name().substring(1) + ".app";
} // EActionHandlerURL()
public Class<? extends ActionHandlerBase> getActionHandlerClass() {
  return _actionHandlerClass;
} // getActionHandlerClass()
public String getURL() {
  return _url;
} // getURL()
public static EActionHandler lookupUsingURL(final String url) {
  synchronized (_actionHandlerMap) {
    if (_actionHandlerMap.size() == 0) {
      for (EActionHandler actionHandler : EActionHandler.values()) {
        _actionHandlerMap.put(actionHandler._url, actionHandler);
      }
    }
  }
  return _actionHandlerMap.get(url);
} // lookupUsingURL()
} // enum EActionHandlerURL

//--------------------------------------------------------------------------------------------------

public enum EServletReqParam {
BaseDAO_deleteDate(false),
BaseDAO_id(false),
BaseDAO_version(false),
GoogleLogin_accountType(false),
GoogleLogin_Email(false),
GoogleLogin_Passwd(false),
GoogleLogin_service(false),
GoogleLogin_source(false),
Loc_desc(false),
Loc_geoPoint(false),
Loc_locTypeIds(true),
Loc_shortDesc(true),
LocType_desc(false),
LocType_shortDesc(true),
OrgDelete_id(false),
OrgGetOne_id(false),
OrgInsert_administratorPersonId(false),
OrgInsert_desc(false),
OrgInsert_id(false),
OrgInsert_name(false),
OrgInsert_namespaceName(false),
OrgInsert_version(false),
OrgUpdate_administratorPersonId(false),
OrgUpdate_desc(false),
OrgUpdate_id(false),
OrgUpdate_name(false),
OrgUpdate_namespaceName(false),
OrgUpdate_version(false),
Person_dateOfBirth(false),
Person_domainUserId(true),
Person_nameFirst(false),
Person_nameLast(false),
Person_phoneNumberHome(false),
Person_phoneNumberMobile(false),
Person_phoneNumberOffice(false),
Person_roleIds(true),
PersonDelete_id(false),
PersonInsert_id(false);
private boolean _isRequired;
private String  _paramName;
private EServletReqParam(final boolean isRequired) {
  _isRequired = isRequired;
} // EServletReqParam()
public String getParamName() {
  if (_paramName == null) {
    _paramName = name().substring(name().indexOf('_') + 1);
  }
  return _paramName;
} // getParamName()
public boolean isRequired() {
  return _isRequired;
} // isRequired()
} // enum EServletReqParam

//--------------------------------------------------------------------------------------------------

public enum EServletReqType {
GoogleLogin,
OrgGetOne
} // enum EServletReqType

//--------------------------------------------------------------------------------------------------

}